package com.b2bpsssm.controller.material.customer;

import com.b2bpsssm.common.R;
import com.b2bpsssm.pojo.Customer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Api(value = "客户页面",tags = "客户接口Api")
public class CustomerController {


//    @RequestMapping(value = "url路径",method = RequestMethod.GET)
//    @ApiOperation(value = "主标题",notes = "主标题描述",httpMethod = "get/post",response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page",value = "当前页码",required = true ),
//            @ApiImplicitParam(name = "limit",value = "每页条数",required = true )
//    })


    /*
    * 客户页页码每页条数查询
    * */
    @RequestMapping(value = "/Customer/queryCustomerByPageLimit",method = RequestMethod.GET)
    @ApiOperation(value = "查询客户",notes = "依靠当前页码和每页条数进行查询",httpMethod = "",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码",required = true ),
            @ApiImplicitParam(name = "limit",value = "每页条数",required = true )
    })
    @ResponseBody
    public R queryCustomerByPageLimit(Integer page, Integer limit){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }


    /*
    * 新增客户
    * */
    @RequestMapping(value = "/Customer/addCustomer",method = RequestMethod.POST)
    @ApiOperation(value = "新增客户",notes = "新增并保存",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cus_Create_Date",value = "创建时间",required = true ),
            @ApiImplicitParam(name = "cus_Id",value = "客户编号",required = true ),
            @ApiImplicitParam(name = "cus_Name",value = "客户名称",required = true ),
            @ApiImplicitParam(name = "cus_Rank",value = "客户等级",required = true ),
            @ApiImplicitParam(name = "cus_Label",value = "标签",required = true ),
            @ApiImplicitParam(name = "cus_Con_Id",value = "联系人编号（关联联系人）",required = true ),
            @ApiImplicitParam(name = "cus_Status",value = "状态（1：启用；2：冻结；3：删除）",required = true ),
            @ApiImplicitParam(name = "cus_Def_War_Id",value = "默认仓库(关联仓库)",required = true ),
            @ApiImplicitParam(name = "cus_Cla_Id",value = "客户分类（关联分类表）",required = true ),
            @ApiImplicitParam(name = "cus_Area_Id",value = "区域(关联区域表)",required = true ),
            @ApiImplicitParam(name = "cus_Detailed_Address",value = "详细地址",required = true ),
            @ApiImplicitParam(name = "cus_Postcode",value = "邮编",required = true ),
            @ApiImplicitParam(name = "cus_Remarks",value = "备注信息",required = true ),
            @ApiImplicitParam(name = "cus_Fin_Id",value = "关联财务信息",required = true ),
    })
    @ResponseBody
    public R addCustomer(Customer Customer){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

    /*
     * 编辑客户
     * */
    @RequestMapping(value = "/Customer/updateCustomer",method = RequestMethod.POST)
    @ApiOperation(value = "修改客户",notes = "保存",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cus_Create_Date",value = "创建时间",required = true ),
            @ApiImplicitParam(name = "cus_Id",value = "客户编号",required = true ),
            @ApiImplicitParam(name = "cus_Name",value = "客户名称",required = true ),
            @ApiImplicitParam(name = "cus_Rank",value = "客户等级",required = true ),
            @ApiImplicitParam(name = "cus_Label",value = "标签",required = true ),
            @ApiImplicitParam(name = "cus_Con_Id",value = "联系人编号（关联联系人）",required = true ),
            @ApiImplicitParam(name = "cus_Status",value = "状态（1：启用；2：冻结；3：删除）",required = true ),
            @ApiImplicitParam(name = "cus_Def_War_Id",value = "默认仓库(关联仓库)",required = true ),
            @ApiImplicitParam(name = "cus_Cla_Id",value = "客户分类（关联分类表）",required = true ),
            @ApiImplicitParam(name = "cus_Area_Id",value = "区域(关联区域表)",required = true ),
            @ApiImplicitParam(name = "cus_Detailed_Address",value = "详细地址",required = true ),
            @ApiImplicitParam(name = "cus_Postcode",value = "邮编",required = true ),
            @ApiImplicitParam(name = "cus_Remarks",value = "备注信息",required = true ),
            @ApiImplicitParam(name = "cus_Fin_Id",value = "关联财务信息",required = true ),
    })
    @ResponseBody
    public R updateCustomer(Customer Customer){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

//    /*
//     * 搜索客户
//     * */
//    @RequestMapping(value = "/Customer/selCustomer",method = RequestMethod.GET)
//    @ApiOperation(value = "搜索客户",notes = "三个条件必选其一",httpMethod = "get",response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "comClass",value = "客户分类",required = true ),
//            @ApiImplicitParam(name = "comCreateDate1",value = "创建时间1",required = true ),
//            @ApiImplicitParam(name = "comCreateDate2",value = "创建时间2",required = true ),
//            @ApiImplicitParam(name = "comNameKey",value = "关键字",required = true )
//    })
//    @ResponseBody
//    public R selCustomer(Customer Customer){
//        R r = new R();
//        r.setCode(200);
//        r.setData(666);
//        r.setMassage("success");
//        return r;
//    }


    /*
     * 删除客户
     * */
    @RequestMapping(value = "/Customer/delCustomer",method = RequestMethod.POST)
    @ApiOperation(value = "删除客户",notes = "删除",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cus_Id",value = "客户编码",required = true )
    })
    @ResponseBody
    public R delCustomer(String comId){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

}
